import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import jquery from 'jquery'
import anime from 'animejs'
import './plugins/element.js'
import store from './store'
import api from './api/index.js'
import './plugins/ant-design-vue.js'
//引入全局样式
import  './assets/compoents.css'

Vue.config.productionTip = false

axios.defaults.baseURI = 'http://localhost:8081/'

Vue.prototype.$http = axios
Vue.prototype.axios = axios
Vue.prototype.$ = jquery
Vue.prototype.$anime = anime
Vue.prototype.$api = api


Vue.filter("test", function(val) {
	if (!localStorage.token) {
		return '没有token'
	}
  val.token = localStorage.token
  return val
})


axios.interceptors.request.use(config => {
	if (config.url != '/user/v1/login') {
		// 表示在配置中的设置头消息的字段Authorization为从本地获取的token值
		 config.headers.token = localStorage.getItem('token')
	}
    config.url = 'http://localhost:8081' + config.url
   return config
 
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
